//
//  MyWeatherBottomBar.m
//  Ghac 4S
//
//  Created by apple on 11-10-26.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//
#import "Global.h"
#import "MyWeatherBottomBarController.h"
#import "MyYahooWeather.h"
#import "MyGoogleWeather.h"
#import "SettingController.h"
@interface MyWeatherBottomBarController(private)
-(void)updateLocationCoordinate:(CLLocationCoordinate2D)coordinate;
-(void)askCityWeatherWithWoeid:(NSString*)woeid;
-(void)queryEvent:(id)sender;
@end

@implementation MyWeatherBottomBarController
@synthesize templetureLabel;
@synthesize weatherImageView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) 
    {
        // Custom initialization

    }
    return self;
}
-(void)setttingBtnClick:(id)sender
{
    id<MainViewSwitchAction> target = [Global mainRootController];
    SettingController* settingcontroller = [[SettingController alloc] init];
    [target showInnerView:settingcontroller];
    [settingcontroller release];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    m_myWeather = [[MyYahooWeather alloc] initWithDelegate:self];
//    m_myWeather = [[MyGoogleWeather alloc] initWithDelegate:self];
}

-(void)onWeatherUpdate:(MyWeather *)sender
{
    NSString* tempStr = [NSString stringWithFormat:@"%@℃", sender.templeture];
    
    [self.templetureLabel setText:tempStr];
    [self.weatherImageView setImage:sender.weatherImage];
    
}
                      
                      
- (void)viewDidUnload
{
    [super viewDidUnload];
    KRELEASE(m_myWeather);
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}
-(void)dealloc
{
    [self viewDidUnload];
    [super dealloc];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
